package com.szgr.baoyin.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;

import com.szgr.baoyin.R;

public class EditActivity extends BaseActivity {

    private EditText et_text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_edit);
        super.onCreate(savedInstanceState);
    }

    @Override
    public void initActionBar() {
        Intent intent = getIntent();
        if(intent != null && intent.hasExtra("where")){
            String where = intent.getStringExtra("where");
            if("nick".equals(where)){
                actionBarTitle.setText("修改昵称");
            }else if("pass".equals(where)){
                actionBarTitle.setText("修改密码");
            }
        }
        actionBarConfirm.setVisibility(View.VISIBLE);
        actionBarConfirm.setText("确定");
    }

    @Override
    public void initView() {
        et_text = (EditText) findViewById(R.id.edit_text);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.action_bar_left:
                finish();
                break;
            case R.id.action_bar_confirm:
                Intent intent = new Intent();
                intent.putExtra("content",et_text.getText().toString().trim());
                setResult(33,intent);
                finish();
                break;
        }
    }
}
